package com.google.android.gms.internal;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.google.android.gms.common.internal.Hide;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.json.JSONObject;

@Hide
@zzabh
public final class zzafv extends zzahs implements zzafu {
    private final Context mContext;
    private final Object mLock;
    private final zzahe zzcob;
    private final long zzdae;
    private final ArrayList<zzafl> zzdaq;
    private final List<zzafo> zzdar;
    private final HashSet<String> zzdas;
    private final zzaeo zzdat;

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public zzafv(android.content.Context r8, com.google.android.gms.internal.zzahe r9, com.google.android.gms.internal.zzaeo r10) {
        /*
            r7 = this;
            com.google.android.gms.internal.zzny<java.lang.Long> r0 = com.google.android.gms.internal.zzoi.zzboz
            com.google.android.gms.internal.zzog r1 = com.google.android.gms.internal.zzlc.zzio()
            java.lang.Object r0 = r1.zzd(r0)
            java.lang.Long r0 = (java.lang.Long) r0
            long r5 = r0.longValue()
            r1 = r7
            r2 = r8
            r3 = r9
            r4 = r10
            r1.<init>(r2, r3, r4, r5)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzafv.<init>(android.content.Context, com.google.android.gms.internal.zzahe, com.google.android.gms.internal.zzaeo):void");
    }

    private zzafv(Context context, zzahe zzahe, zzaeo zzaeo, long j) {
        this.zzdaq = new ArrayList<>();
        this.zzdar = new ArrayList();
        this.zzdas = new HashSet<>();
        this.mLock = new Object();
        this.mContext = context;
        this.zzcob = zzahe;
        this.zzdat = zzaeo;
        this.zzdae = j;
    }

    private final zzahd zza(int i, @Nullable String str, @Nullable zzvp zzvp) {
        zzkk zzkk = this.zzcob.zzcvm.zzcrv;
        List<String> list = this.zzcob.zzdcw.zzchw;
        List<String> list2 = this.zzcob.zzdcw.zzchx;
        List<String> list3 = this.zzcob.zzdcw.zzctq;
        int i2 = this.zzcob.zzdcw.orientation;
        long j = this.zzcob.zzdcw.zzcic;
        String str2 = this.zzcob.zzcvm.zzcry;
        boolean z = this.zzcob.zzdcw.zzcto;
        zzvq zzvq = this.zzcob.zzdcj;
        long j2 = this.zzcob.zzdcw.zzctp;
        zzko zzko = this.zzcob.zzaud;
        long j3 = j2;
        long j4 = this.zzcob.zzdcw.zzctn;
        long j5 = this.zzcob.zzdcn;
        long j6 = this.zzcob.zzdcw.zzcts;
        String str3 = this.zzcob.zzdcw.zzctt;
        JSONObject jSONObject = this.zzcob.zzdch;
        zzagd zzagd = this.zzcob.zzdcw.zzcuc;
        List<String> list4 = this.zzcob.zzdcw.zzcud;
        List<String> list5 = this.zzcob.zzdcw.zzcue;
        boolean z2 = this.zzcob.zzdcw.zzcuf;
        zzacl zzacl = this.zzcob.zzdcw.zzcug;
        String zzpb = zzpb();
        List<String> list6 = this.zzcob.zzdcw.zzchz;
        String str4 = this.zzcob.zzdcw.zzcuj;
        zziu zziu = this.zzcob.zzdcu;
        zzko zzko2 = zzko;
        String str5 = str3;
        zzvq zzvq2 = zzvq;
        return new zzahd(zzkk, (zzaof) null, list, i, list2, list3, i2, j, str2, z, zzvp, (zzwi) null, str, zzvq2, (zzvs) null, j3, zzko2, j4, j5, j6, str5, jSONObject, (zzpx) null, zzagd, list4, list5, z2, zzacl, zzpb, list6, str4, zziu, this.zzcob.zzdcw.zzaqw, this.zzcob.zzdcv);
    }

    private final String zzpb() {
        StringBuilder sb = new StringBuilder("");
        if (this.zzdar == null) {
            return sb.toString();
        }
        Iterator<zzafo> it = this.zzdar.iterator();
        while (true) {
            int i = 1;
            if (!it.hasNext()) {
                return sb.substring(0, Math.max(0, sb.length() - 1));
            }
            zzafo next = it.next();
            if (next != null && !TextUtils.isEmpty(next.zzche)) {
                String str = next.zzche;
                switch (next.errorCode) {
                    case 3:
                        break;
                    case 4:
                        i = 2;
                        break;
                    case 5:
                        i = 4;
                        break;
                    case 6:
                        i = 0;
                        break;
                    case 7:
                        i = 3;
                        break;
                    default:
                        i = 6;
                        break;
                }
                long j = next.zzcjj;
                StringBuilder sb2 = new StringBuilder(33 + String.valueOf(str).length());
                sb2.append(str);
                sb2.append(".");
                sb2.append(i);
                sb2.append(".");
                sb2.append(j);
                sb.append(String.valueOf(sb2.toString()).concat("_"));
            }
        }
    }

    public final void onStop() {
    }

    public final void zza(String str, int i) {
    }

    public final void zzbr(String str) {
        synchronized (this.mLock) {
            this.zzdas.add(str);
        }
    }

    /*  JADX ERROR: IndexOutOfBoundsException in pass: RegionMakerVisitor
        java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        	at java.util.ArrayList.get(ArrayList.java:433)
        	at jadx.core.dex.nodes.InsnNode.getArg(InsnNode.java:101)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:611)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.processMonitorEnter(RegionMaker.java:561)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:133)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:86)
        	at jadx.core.dex.visitors.regions.RegionMaker.processExcHandler(RegionMaker.java:1043)
        	at jadx.core.dex.visitors.regions.RegionMaker.processTryCatchBlocks(RegionMaker.java:975)
        	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:52)
        */
    /* JADX WARNING: Missing exception handler attribute for start block: B:93:0x0165 */
    public final void zzdo() {
        /*
            r20 = this;
            r11 = r20
            com.google.android.gms.internal.zzahe r1 = r11.zzcob
            com.google.android.gms.internal.zzvq r1 = r1.zzdcj
            java.util.List<com.google.android.gms.internal.zzvp> r1 = r1.zzchv
            java.util.Iterator r12 = r1.iterator()
        L_0x000c:
            boolean r1 = r12.hasNext()
            if (r1 == 0) goto L_0x00c0
            java.lang.Object r1 = r12.next()
            r13 = r1
            com.google.android.gms.internal.zzvp r13 = (com.google.android.gms.internal.zzvp) r13
            java.lang.String r14 = r13.zzchk
            java.util.List<java.lang.String> r1 = r13.zzchd
            java.util.Iterator r15 = r1.iterator()
        L_0x0021:
            boolean r1 = r15.hasNext()
            if (r1 == 0) goto L_0x000c
            java.lang.Object r1 = r15.next()
            java.lang.String r1 = (java.lang.String) r1
            java.lang.String r2 = "com.google.android.gms.ads.mediation.customevent.CustomEventAdapter"
            boolean r2 = r2.equals(r1)
            if (r2 != 0) goto L_0x0040
            java.lang.String r2 = "com.google.ads.mediation.customevent.CustomEventAdapter"
            boolean r2 = r2.equals(r1)
            if (r2 == 0) goto L_0x003e
            goto L_0x0040
        L_0x003e:
            r3 = r1
            goto L_0x004c
        L_0x0040:
            org.json.JSONObject r1 = new org.json.JSONObject     // Catch:{ JSONException -> 0x00b3 }
            r1.<init>(r14)     // Catch:{ JSONException -> 0x00b3 }
            java.lang.String r2 = "class_name"
            java.lang.String r1 = r1.getString(r2)     // Catch:{ JSONException -> 0x00b3 }
            goto L_0x003e
        L_0x004c:
            java.lang.Object r9 = r11.mLock
            monitor-enter(r9)
            com.google.android.gms.internal.zzaeo r1 = r11.zzdat     // Catch:{ all -> 0x00ab }
            com.google.android.gms.internal.zzafy r7 = r1.zzbq(r3)     // Catch:{ all -> 0x00ab }
            if (r7 == 0) goto L_0x0083
            com.google.android.gms.internal.zzaft r1 = r7.zzpd()     // Catch:{ all -> 0x00ab }
            if (r1 == 0) goto L_0x0083
            com.google.android.gms.internal.zzwi r1 = r7.zzpc()     // Catch:{ all -> 0x00ab }
            if (r1 != 0) goto L_0x0064
            goto L_0x0083
        L_0x0064:
            com.google.android.gms.internal.zzafl r10 = new com.google.android.gms.internal.zzafl     // Catch:{ all -> 0x00ab }
            android.content.Context r2 = r11.mContext     // Catch:{ all -> 0x00ab }
            com.google.android.gms.internal.zzahe r6 = r11.zzcob     // Catch:{ all -> 0x00ab }
            long r4 = r11.zzdae     // Catch:{ all -> 0x00ab }
            r1 = r10
            r16 = r4
            r4 = r14
            r5 = r13
            r8 = r11
            r18 = r9
            r19 = r12
            r12 = r10
            r9 = r16
            r1.<init>(r2, r3, r4, r5, r6, r7, r8, r9)     // Catch:{ all -> 0x00b1 }
            java.util.ArrayList<com.google.android.gms.internal.zzafl> r1 = r11.zzdaq     // Catch:{ all -> 0x00b1 }
            r1.add(r12)     // Catch:{ all -> 0x00b1 }
        L_0x0081:
            monitor-exit(r18)     // Catch:{ all -> 0x00b1 }
            goto L_0x00bc
        L_0x0083:
            r18 = r9
            r19 = r12
            java.util.List<com.google.android.gms.internal.zzafo> r1 = r11.zzdar     // Catch:{ all -> 0x00b1 }
            com.google.android.gms.internal.zzafq r2 = new com.google.android.gms.internal.zzafq     // Catch:{ all -> 0x00b1 }
            r2.<init>()     // Catch:{ all -> 0x00b1 }
            java.lang.String r4 = r13.zzche     // Catch:{ all -> 0x00b1 }
            com.google.android.gms.internal.zzafq r2 = r2.zzbt(r4)     // Catch:{ all -> 0x00b1 }
            com.google.android.gms.internal.zzafq r2 = r2.zzbs(r3)     // Catch:{ all -> 0x00b1 }
            r3 = 0
            com.google.android.gms.internal.zzafq r2 = r2.zzg(r3)     // Catch:{ all -> 0x00b1 }
            r3 = 7
            com.google.android.gms.internal.zzafq r2 = r2.zzab(r3)     // Catch:{ all -> 0x00b1 }
            com.google.android.gms.internal.zzafo r2 = r2.zzpa()     // Catch:{ all -> 0x00b1 }
            r1.add(r2)     // Catch:{ all -> 0x00b1 }
            goto L_0x0081
        L_0x00ab:
            r0 = move-exception
            r18 = r9
        L_0x00ae:
            r1 = r0
            monitor-exit(r18)     // Catch:{ all -> 0x00b1 }
            throw r1
        L_0x00b1:
            r0 = move-exception
            goto L_0x00ae
        L_0x00b3:
            r0 = move-exception
            r19 = r12
            r1 = r0
            java.lang.String r2 = "Unable to determine custom event class name, skipping..."
            com.google.android.gms.internal.zzahw.zzb(r2, r1)
        L_0x00bc:
            r12 = r19
            goto L_0x0021
        L_0x00c0:
            java.util.HashSet r1 = new java.util.HashSet
            r1.<init>()
            java.util.ArrayList<com.google.android.gms.internal.zzafl> r2 = r11.zzdaq
            java.util.ArrayList r2 = (java.util.ArrayList) r2
            int r3 = r2.size()
            r4 = 0
            r5 = r4
        L_0x00cf:
            if (r5 >= r3) goto L_0x00e5
            java.lang.Object r6 = r2.get(r5)
            int r5 = r5 + 1
            com.google.android.gms.internal.zzafl r6 = (com.google.android.gms.internal.zzafl) r6
            java.lang.String r7 = r6.zzcip
            boolean r7 = r1.add(r7)
            if (r7 == 0) goto L_0x00cf
            r6.zzow()
            goto L_0x00cf
        L_0x00e5:
            java.util.ArrayList<com.google.android.gms.internal.zzafl> r1 = r11.zzdaq
            java.util.ArrayList r1 = (java.util.ArrayList) r1
            int r2 = r1.size()
        L_0x00ed:
            if (r4 >= r2) goto L_0x01a0
            java.lang.Object r3 = r1.get(r4)
            int r4 = r4 + 1
            com.google.android.gms.internal.zzafl r3 = (com.google.android.gms.internal.zzafl) r3
            java.util.concurrent.Future r5 = r3.zzow()     // Catch:{ InterruptedException -> 0x0165, Exception -> 0x0144 }
            r5.get()     // Catch:{ InterruptedException -> 0x0165, Exception -> 0x0144 }
            java.lang.Object r5 = r11.mLock
            monitor-enter(r5)
            java.lang.String r6 = r3.zzcip     // Catch:{ all -> 0x013d }
            boolean r6 = android.text.TextUtils.isEmpty(r6)     // Catch:{ all -> 0x013d }
            if (r6 != 0) goto L_0x0112
            java.util.List<com.google.android.gms.internal.zzafo> r6 = r11.zzdar     // Catch:{ all -> 0x013d }
            com.google.android.gms.internal.zzafo r7 = r3.zzox()     // Catch:{ all -> 0x013d }
            r6.add(r7)     // Catch:{ all -> 0x013d }
        L_0x0112:
            monitor-exit(r5)     // Catch:{ all -> 0x013d }
            java.lang.Object r6 = r11.mLock
            monitor-enter(r6)
            java.util.HashSet<java.lang.String> r5 = r11.zzdas     // Catch:{ all -> 0x0139 }
            java.lang.String r7 = r3.zzcip     // Catch:{ all -> 0x0139 }
            boolean r5 = r5.contains(r7)     // Catch:{ all -> 0x0139 }
            if (r5 == 0) goto L_0x0137
            java.lang.String r1 = r3.zzcip     // Catch:{ all -> 0x0139 }
            com.google.android.gms.internal.zzvp r2 = r3.zzoy()     // Catch:{ all -> 0x0139 }
            r3 = -2
            com.google.android.gms.internal.zzahd r1 = r11.zza(r3, r1, r2)     // Catch:{ all -> 0x0139 }
            android.os.Handler r2 = com.google.android.gms.internal.zzako.zzaju     // Catch:{ all -> 0x0139 }
            com.google.android.gms.internal.zzafw r3 = new com.google.android.gms.internal.zzafw     // Catch:{ all -> 0x0139 }
            r3.<init>(r11, r1)     // Catch:{ all -> 0x0139 }
            r2.post(r3)     // Catch:{ all -> 0x0139 }
            monitor-exit(r6)     // Catch:{ all -> 0x0139 }
            return
        L_0x0137:
            monitor-exit(r6)     // Catch:{ all -> 0x0139 }
            goto L_0x00ed
        L_0x0139:
            r0 = move-exception
            r1 = r0
            monitor-exit(r6)     // Catch:{ all -> 0x0139 }
            throw r1
        L_0x013d:
            r0 = move-exception
            r1 = r0
            monitor-exit(r5)     // Catch:{ all -> 0x013d }
            throw r1
        L_0x0141:
            r0 = move-exception
            r1 = r0
            goto L_0x0186
        L_0x0144:
            r0 = move-exception
            r5 = r0
            java.lang.String r6 = "Unable to resolve rewarded adapter."
            com.google.android.gms.internal.zzahw.zzc(r6, r5)     // Catch:{ all -> 0x0141 }
            java.lang.Object r5 = r11.mLock
            monitor-enter(r5)
            java.lang.String r6 = r3.zzcip     // Catch:{ all -> 0x0161 }
            boolean r6 = android.text.TextUtils.isEmpty(r6)     // Catch:{ all -> 0x0161 }
            if (r6 != 0) goto L_0x015f
            java.util.List<com.google.android.gms.internal.zzafo> r6 = r11.zzdar     // Catch:{ all -> 0x0161 }
            com.google.android.gms.internal.zzafo r3 = r3.zzox()     // Catch:{ all -> 0x0161 }
            r6.add(r3)     // Catch:{ all -> 0x0161 }
        L_0x015f:
            monitor-exit(r5)     // Catch:{ all -> 0x0161 }
            goto L_0x00ed
        L_0x0161:
            r0 = move-exception
            r1 = r0
            monitor-exit(r5)     // Catch:{ all -> 0x0161 }
            throw r1
        L_0x0165:
            java.lang.Thread r1 = java.lang.Thread.currentThread()     // Catch:{ all -> 0x0141 }
            r1.interrupt()     // Catch:{ all -> 0x0141 }
            java.lang.Object r1 = r11.mLock
            monitor-enter(r1)
            java.lang.String r2 = r3.zzcip     // Catch:{ all -> 0x0182 }
            boolean r2 = android.text.TextUtils.isEmpty(r2)     // Catch:{ all -> 0x0182 }
            if (r2 != 0) goto L_0x0180
            java.util.List<com.google.android.gms.internal.zzafo> r2 = r11.zzdar     // Catch:{ all -> 0x0182 }
            com.google.android.gms.internal.zzafo r3 = r3.zzox()     // Catch:{ all -> 0x0182 }
            r2.add(r3)     // Catch:{ all -> 0x0182 }
        L_0x0180:
            monitor-exit(r1)     // Catch:{ all -> 0x0182 }
            goto L_0x01a0
        L_0x0182:
            r0 = move-exception
            r2 = r0
            monitor-exit(r1)     // Catch:{ all -> 0x0182 }
            throw r2
        L_0x0186:
            java.lang.Object r2 = r11.mLock
            monitor-enter(r2)
            java.lang.String r4 = r3.zzcip     // Catch:{ all -> 0x019c }
            boolean r4 = android.text.TextUtils.isEmpty(r4)     // Catch:{ all -> 0x019c }
            if (r4 != 0) goto L_0x019a
            java.util.List<com.google.android.gms.internal.zzafo> r4 = r11.zzdar     // Catch:{ all -> 0x019c }
            com.google.android.gms.internal.zzafo r3 = r3.zzox()     // Catch:{ all -> 0x019c }
            r4.add(r3)     // Catch:{ all -> 0x019c }
        L_0x019a:
            monitor-exit(r2)     // Catch:{ all -> 0x019c }
            throw r1
        L_0x019c:
            r0 = move-exception
            r1 = r0
            monitor-exit(r2)     // Catch:{ all -> 0x019c }
            throw r1
        L_0x01a0:
            r1 = 3
            r2 = 0
            com.google.android.gms.internal.zzahd r1 = r11.zza(r1, r2, r2)
            android.os.Handler r2 = com.google.android.gms.internal.zzako.zzaju
            com.google.android.gms.internal.zzafx r3 = new com.google.android.gms.internal.zzafx
            r3.<init>(r11, r1)
            r2.post(r3)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzafv.zzdo():void");
    }

    /* access modifiers changed from: package-private */
    public final /* synthetic */ void zzl(zzahd zzahd) {
        this.zzdat.zzoq().zzb(zzahd);
    }

    /* access modifiers changed from: package-private */
    public final /* synthetic */ void zzm(zzahd zzahd) {
        this.zzdat.zzoq().zzb(zzahd);
    }
}
